package v3.chapter1.t20;

import java.util.Random; 

public class Run {

	public static void main(String[] args) {
		for(int i=0;i<5;i++) {
			MyThread1 t1=new MyThread1();
			t1.setPriority(5);
			t1.start();
			
			MyThread2 t2=new MyThread2();
			t2.setPriority(6);
			t2.start();
		}

	}

}

class MyThread1 extends Thread {

	@Override
	public void run() {
		long beginTime = System.currentTimeMillis();

		for (int i = 0; i < 1000; i++) {
			Random random = new Random();
			random.nextInt();
		}

		long endTime = System.currentTimeMillis();
		System.out.println("★★★★★★ thread 1 use time=" + (endTime - beginTime));
	}

}

class MyThread2 extends Thread {

	@Override
	public void run() {
		long beginTime = System.currentTimeMillis();
		for (int i = 0; i < 1000; i++) {
			Random random = new Random();
			random.nextInt(); 
		}

		long endTime = System.currentTimeMillis();
		System.out.println("☆☆☆☆☆☆ thread 2 use time=" + (endTime - beginTime));
	}

}
